package com.itheima.logdemo.web;

import com.itheima.logdemo.utils.MyRestTemplate;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

@SpringBootApplication
@EnableDiscoveryClient
@RestController
@ComponentScan("com.itheima.logdemo")
@EnableCircuitBreaker
public class WebApp {
    private Logger logger = LoggerFactory.getLogger("kafka");
    
    public static void main(String[] args) {
        new SpringApplicationBuilder(WebApp.class).run(args);
    }
    
    @LoadBalanced
    @Bean
    RestTemplate getRestTemplate() {
//        return new RestTemplate();
        return new MyRestTemplate();
    }
}
